/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.fyx.core.entity;

import cz.makrobioklub.action.entity.Action;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author xljan
 */
@Entity
@Table(name = "fyx_address")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FyxAddress.findAll", query = "SELECT f FROM FyxAddress f"),
    @NamedQuery(name = "FyxAddress.findByIdAddress", query = "SELECT f FROM FyxAddress f WHERE f.idAddress = :idAddress"),
    @NamedQuery(name = "FyxAddress.findByCity", query = "SELECT f FROM FyxAddress f WHERE f.city = :city"),
    @NamedQuery(name = "FyxAddress.findByStreet", query = "SELECT f FROM FyxAddress f WHERE f.street = :street"),
    @NamedQuery(name = "FyxAddress.findByZip", query = "SELECT f FROM FyxAddress f WHERE f.zip = :zip"),
    @NamedQuery(name = "FyxAddress.findByName", query = "SELECT f FROM FyxAddress f WHERE f.name = :name")})
public class FyxAddress implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_address")
    private Integer idAddress;
    @Size(max = 255)
    @Column(name = "city")
    private String city;
    @Size(max = 255)
    @Column(name = "street")
    private String street;
    @Size(max = 255)
    @Column(name = "zip")
    private String zip;
    @Size(max = 255)
    @Column(name = "name")
    private String name;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idAddress")
    private Collection<Action> actionCollection;

    public FyxAddress() {
    }

    public FyxAddress(Integer idAddress) {
        this.idAddress = idAddress;
    }

    public Integer getIdAddress() {
        return idAddress;
    }

    public void setIdAddress(Integer idAddress) {
        this.idAddress = idAddress;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getStreet() {
        return street;
    }

    public void setStreet(String street) {
        this.street = street;
    }

    public String getZip() {
        return zip;
    }

    public void setZip(String zip) {
        this.zip = zip;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @XmlTransient
    public Collection<Action> getActionCollection() {
        return actionCollection;
    }

    public void setActionCollection(Collection<Action> actionCollection) {
        this.actionCollection = actionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAddress != null ? idAddress.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FyxAddress)) {
            return false;
        }
        FyxAddress other = (FyxAddress) object;
        if ((this.idAddress == null && other.idAddress != null) || (this.idAddress != null && !this.idAddress.equals(other.idAddress))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cz.makrobioklub.action.entity.FyxAddress[ idAddress=" + idAddress + " ]";
    }
    
}
